/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 87111
 * Date: 2025-09-20
 * Time: 21:21
 */
public class TestQuestion {
    public static void main(String[] args) {
        int[] num = {3,2,2,3};
        int a = removeElement(num,3);
        System.out.println(a);
    }
    public static int removeElement(int[] nums, int val) {
        int count = 0;
        for(int i = 0; i < nums.length; i++) {
            if(nums[i] == val) {
                count++;
                for(int j = i + 1; j < nums.length; j++) {
                    nums[j-1] = nums[j];
                }
            }
        }
        return count;
    }
}
